<div class="bg-light lter b-b wrapper-md">
    <h1 class="m-n font-thin h3"><a id="head" ></a>组织结构管理</h1>
</div>
<div class="col-sm-12" ng-controller="groupViewController">
    <ng-form role="form" name="form" class="form-validation">
        <uib-tabset justified="true" class="tab-container">
            <uib-tab heading="基本信息">
                <div class="panel panel-default">
                    <div class="panel-heading">
                    </div>

                    <div class="panel-body">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">区域</label>
                            <div class="col-sm-9">
                                <!--<ui-select ng-model="region.selected" theme="bootstrap" name="region" class=" m-b-xs" required>-->
                                <!--<ui-select-match placeholder="请选择片区">{{$select.selected.name}}</ui-select-match>-->
                                <!--<ui-select-choices group-by="'group'" repeat="region in regions | filter: $select.search">-->
                                <!--<div ng-bind-html="region.name | highlight: $select.search"></div>-->
                                <!--<small>-->
                                    <!--区域编码: {{region.code}}-->
                                    <!--<span ng-if="region.parentId">-->
                                    <!--上级区域: <span ng-bind-html="region.parentId | sys_region_Fiter:'name' | highlight: $select.search"></span>-->
                                    <!--</span>-->
                                <!--</small>-->
                                <!--</ui-select>-->
                                <input type="text" ng-click="openRegionTree()" class="form-control m-b-xs" placeholder="区域" ng-model="entity.areaId | sys_region_Fiter:'name'" required >
                            </div>
                        </div>
                        <div class="line line-dashed b-b line-lg pull-in"></div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">上级机构名称</label>
                            <div class="col-sm-9">
                                <input type="text" ng-click="openGroupTree()" class="form-control m-b-xs" placeholder="上级机构" ng-model="entity.parentId | sys_group_Fiter:'name'" >
                            </div>
                        </div>
                        <div class="line line-dashed b-b line-lg pull-in"></div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">机构名称</label>
                            <div class="col-sm-9">
                                <input type="text" name="name" class="form-control  m-b-xs" placeholder="机构名称" ui-validate-async="{unique : 'uniqueGroup($value)' }" ng-model="entity.name" required >
                                <div class="bg-danger" ng-show="form.name.$invalid">
                                    <div ng-show="form.name.$error.unique">机构名称已经存在，请重新输入。</div>
                                </div>
                            </div>
                        </div>
                        <div class="line line-dashed b-b line-lg pull-in"></div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">机构等级</label>
                            <div class="col-sm-9">
                                <select class="form-control m-b-xs" placeholder="机构等级" ng-model="entity.type" ng-init="entity.type = '1'"  required
                                        ng-options="row.value as row.label for row in dictionary.sysOfficeGrade">
                                </select>
                            </div>
                        </div>
                        <div class="line line-dashed b-b line-lg pull-in"></div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">编码</label>
                            <div class="col-sm-9">
                                <input name="group" type="text" class="form-control m-b-xs" placeholder="编码" ui-validate-async="{unique : 'unique($value)' }" ng-model="entity.group" required >
                                <div class="bg-danger" ng-show="form.group.$invalid">
                                    <div ng-show="form.group.$error.unique">编码已经存在，请重新输入。</div>
                                </div>
                            </div>
                        </div>
                        <div class="line line-dashed b-b line-lg pull-in"></div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">负责人</label>
                            <div class="col-sm-9">
                                <input type="text" class="form-control m-b-xs" placeholder="负责人" ng-model="entity.master" required >
                            </div>
                        </div>
                        <div class="line line-dashed b-b line-lg pull-in"></div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">备注</label>
                            <div class="col-sm-9">
                                <textarea type="text" class="form-control m-b-xs" placeholder="备注" ng-model="entity.remarks" />
                            </div>
                        </div>
                        <div class="line line-dashed b-b line-lg pull-in"></div>
                        <div class="form-group" ng-repeat="role in Grid.getSelectedRows()">
                            <label class="col-sm-3 control-label">角色</label>
                            <div class="col-sm-9">
                                <p>{{role.name}}</p>
                            </div>
                        </div>
                    </div>
                </div>
            </uib-tab>
            <uib-tab heading="角色信息" select="Grid.resize()">
                <div class="table-responsive">
                    <div ui-grid="Grid.gridOptions" ui-grid-resize-columns ui-grid-selection ui-grid-pagination ui-grid-move-columns class="ag-fresh" style="min-height: 500px;"></div>
                </div>
            </uib-tab>
        </uib-tabset>
        <footer class="panel-footer  lter">
            <!-- alert -->
            <div class="m-b-md">
                <uib-alert ng-repeat="alert in Alert.alerts" type="{{alert.type}}" close="Alert.closeAlert($index)">{{alert.msg}}</uib-alert>
            </div>
            <!-- / alert -->
            <button type="submit" class="btn btn-success" ng-disabled="form.$invalid || saveBtnDisable" ng-click="save(); saveBtnDisable = true;">保存</button>
            <button type="submit" class="btn btn-success" ng-click="canle()">返回</button>
        </footer>
    </ng-form>
</div>